//
//  MakeCashTableViewController.m
//  消费100
//
//  Created by eliot on 16/3/29.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "MakeCashTableViewController.h"
#import "ImageTableViewCell.h"
#import "PayDetailTableViewCell.h"
#import "MakeCashSuccessViewController.h"
#import "MakeCashHistoryTableViewController.h"
@interface MakeCashTableViewController ()

@property (nonatomic, strong) UITextField *cashTextField;
@property (nonatomic, strong) UITextField *weichatTextField;
@property (nonatomic, strong) UITextField *zhifubaoTextField;
@property (nonatomic, strong) UITextField *personNameTextField;
@property (nonatomic) BOOL isPayByWeiChat;
@property (nonatomic) BOOL zhifubaoIsSelected;
@property (nonatomic) BOOL weichatIsSelected;

@end

@implementation MakeCashTableViewController

+(MakeCashTableViewController*)CreatMakeCashTableViewController{
    
    UIStoryboard *story=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    
    MakeCashTableViewController *MakeCashTableViewController=[story instantiateViewControllerWithIdentifier:@"MakeCashTableViewController"];
    
    return MakeCashTableViewController;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isPayByWeiChat = YES;
    self.weichatIsSelected = YES;
    self.zhifubaoIsSelected = NO;
    [self.tableView registerNib:[UINib nibWithNibName:@"ImageTableViewCell" bundle:nil] forCellReuseIdentifier:@"ImageTableViewCell"];
     [self.tableView registerNib:[UINib nibWithNibName:@"PayDetailTableViewCell" bundle:nil] forCellReuseIdentifier:@"PayDetailTableViewCell"];
    self.title = @"提现";
    self.tableView.backgroundColor = [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1];
    /** 设置导航啦样式*/
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:19],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    self.navigationController.navigationBar.translucent = NO;
    self.tableView.tableFooterView = [[UIView alloc] init];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
 
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 2) {
        if (self.isPayByWeiChat) {
            return 5;
        }else {
            return 6;
        }
    }else {
        return 1;
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (self.isPayByWeiChat) {
        
        if (indexPath.section == 0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"firstcell"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"firstcell"];
            }
            cell.backgroundColor = [UIColor colorWithRed:255/255.0 green:88/255.0 blue:88/255.0 alpha:1];
            UILabel *moneyLabel = [[UILabel alloc] init];
            moneyLabel.textColor = [UIColor whiteColor];
            moneyLabel.font = [UIFont systemFontOfSize:28];
            moneyLabel.text = @"3200.00";
            moneyLabel.textAlignment = NSTextAlignmentCenter;
            [cell addSubview:moneyLabel];
            [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.top.mas_equalTo(118 / 400.0 *Width / 2.0 -18/Width *414.0);
                make.height.mas_equalTo(30);
                
            }];
            
            UILabel *label = [[UILabel alloc] init];
            label.textColor = [UIColor whiteColor];
            label.text = @"可提现余额(元)";
            label.textAlignment = NSTextAlignmentCenter;
            label.font = [UIFont systemFontOfSize:14];
            [cell addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.top.mas_equalTo(moneyLabel.mas_bottom).mas_equalTo(2);
                make.height.mas_equalTo(19);
            }];
            
            
            
            return cell;
        }else if (indexPath.section == 1){
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
            }
            cell.textLabel.text = @"提现记录";
            cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
            UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_arrows"]];
            iv.frame = CGRectMake(0, 0, 12, 12);
            iv.contentMode = UIViewContentModeScaleAspectFit;
            cell.accessoryView = iv;
            return cell;
        }else{
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"textCell1"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"textCell1"];
            }
            if (indexPath.row == 0) {
                cell.textLabel.text = @"提现金额(元)";
                cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
                self.cashTextField = [[UITextField alloc] init];
                [cell addSubview:self.cashTextField];
                [self.cashTextField mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.mas_equalTo(-8);
                    make.top.mas_equalTo(4);
                    make.bottom.mas_equalTo(-4);
                    make.width.mas_equalTo(Width / 2.0 + 40);
                }];
                self.cashTextField.font = [UIFont systemFontOfSize: 16];
                self.cashTextField.textAlignment = NSTextAlignmentRight;
                self.cashTextField.placeholder = @"请输入提现金额";
                return cell;
            }else if (indexPath.row == 1) {
                PayDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PayDetailTableViewCell" forIndexPath:indexPath];
               
                cell.checkIV.hidden = YES;
                
                cell.iconIVLeft.constant = 15;
                cell.bgView.layer.borderWidth = 1;
                cell.bgView.layer.borderColor = [[UIColor grayColor] CGColor];
                cell.bgView.layer.cornerRadius = 12.5;
                cell.bgView.layer.masksToBounds = YES;
                cell.iconIV.image = [UIImage imageNamed:@"iocn_alipay"];
                cell.titleLb.text = @"支付宝";
                return cell;
            }else if (indexPath.row == 2) {
                PayDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PayDetailTableViewCell" forIndexPath:indexPath];
                if (self.weichatIsSelected) {
                    cell.checkIV.hidden = NO;
                }else {
                    cell.checkIV.hidden = YES;
                }
                cell.iconIVLeft.constant = 15;
                cell.bgView.layer.borderWidth = 1;
                cell.bgView.layer.borderColor = [[UIColor grayColor] CGColor];
                cell.bgView.layer.cornerRadius = 12.5;
                cell.bgView.layer.masksToBounds = YES;
                cell.iconIV.image = [UIImage imageNamed:@"icon_wechat"];
                cell.titleLb.text = @"微信";
                return cell;
            }else if (indexPath.row == 3){
                UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell6"] ;
                if (!cell) {
                    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell6"];
                }
                cell.textLabel.text = @"微信账号";
                cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
                self.weichatTextField= [[UITextField alloc] init];
                [cell addSubview:self.weichatTextField];
                [self.weichatTextField mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.mas_equalTo(-8);
                    make.top.mas_equalTo(4);
                    make.bottom.mas_equalTo(-4);
                    make.width.mas_equalTo(Width / 2.0 + 40);
                }];
                self.weichatTextField.font = [UIFont systemFontOfSize: 16];
                self.weichatTextField.textAlignment = NSTextAlignmentRight;
                self.weichatTextField.placeholder = @"请输入微信账号";
                return cell;
            }else {
                UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"lastCell"];
                if (!cell) {
                    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"lastCell"];
                }
                UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
                [cell addSubview:btn];
                btn.backgroundColor = [UIColor colorWithRed:255/255.0 green:88/255.0 blue:88/255.0 alpha:1];
                [btn addTarget:self action:@selector(clickMakeCashBtn) forControlEvents:UIControlEventTouchUpInside];
                [btn setTitle:@"我要提现" forState:UIControlStateNormal];
                [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.mas_equalTo(20);
                    make.right.mas_equalTo(-20);
                    make.top.mas_equalTo(20);
                    make.height.mas_equalTo(40);
                }];
                btn.layer.cornerRadius = 6;
                btn.layer.masksToBounds = YES;
                return cell;
            }
        }
    }else {

        if (indexPath.section == 0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"firstcell"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"firstcell"];
            }
            cell.backgroundColor = [UIColor colorWithRed:255/255.0 green:88/255.0 blue:88/255.0 alpha:1];
            UILabel *moneyLabel = [[UILabel alloc] init];
            moneyLabel.textColor = [UIColor whiteColor];
            moneyLabel.font = [UIFont systemFontOfSize:28];
            moneyLabel.text = @"3200.00";
            moneyLabel.textAlignment = NSTextAlignmentCenter;
            [cell addSubview:moneyLabel];
            [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.top.mas_equalTo(118 / 400.0 *Width / 2.0 -18/Width *414.0);
                make.height.mas_equalTo(30);
                
            }];
            
            UILabel *label = [[UILabel alloc] init];
            label.textColor = [UIColor whiteColor];
            label.text = @"可提现余额(元)";
            label.textAlignment = NSTextAlignmentCenter;
            label.font = [UIFont systemFontOfSize:14];
            [cell addSubview:label];
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.mas_equalTo(0);
                make.top.mas_equalTo(moneyLabel.mas_bottom).mas_equalTo(2);
                make.height.mas_equalTo(19);
            }];
            return cell;
        }else if (indexPath.section == 1){
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell2"];
            }
            cell.textLabel.text = @"提现记录";
            cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
            UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_arrows"]];
            iv.frame = CGRectMake(0, 0, 12, 12);
            iv.contentMode = UIViewContentModeScaleAspectFit;
            cell.accessoryView = iv;
            return cell;
        }else{
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell3"] ;
            if (!cell) {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell3"];
            }
            if (indexPath.row == 0) {
                cell.textLabel.text = @"提现金额(元)";
                cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
                self.cashTextField = [[UITextField alloc] init];
                [cell addSubview:self.cashTextField];
                [self.cashTextField mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.mas_equalTo(-8);
                    make.top.mas_equalTo(4);
                    make.bottom.mas_equalTo(-4);
                    make.width.mas_equalTo(Width / 2.0 + 40);
                }];
                self.cashTextField.font = [UIFont systemFontOfSize: 16];
                self.cashTextField.textAlignment = NSTextAlignmentRight;
                self.cashTextField.placeholder = @"请输入提现金额";
                return cell;
            }else if (indexPath.row == 1) {
                PayDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PayDetailTableViewCell" forIndexPath:indexPath];
                cell.iconIVLeft.constant = 15;
                cell.bgView.layer.borderWidth = 1;
                cell.bgView.layer.borderColor = [[UIColor grayColor] CGColor];
                if (self.zhifubaoIsSelected) {
                    cell.checkIV.hidden = NO;
                }else {
                    cell.checkIV.hidden = YES;
                }
                cell.bgView.layer.cornerRadius = 12.5;
                cell.bgView.layer.masksToBounds = YES;
                cell.iconIV.image = [UIImage imageNamed:@"iocn_alipay"];
                cell.titleLb.text = @"支付宝";
                return cell;
            }else if (indexPath.row == 2) {
                PayDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PayDetailTableViewCell" forIndexPath:indexPath];
                cell.iconIVLeft.constant = 15;
                cell.bgView.layer.borderWidth = 1;
                cell.bgView.layer.borderColor = [[UIColor grayColor] CGColor];
                cell.checkIV.hidden = YES;
                cell.bgView.layer.cornerRadius = 12.5;
                cell.bgView.layer.masksToBounds = YES;
                cell.iconIV.image = [UIImage imageNamed:@"icon_wechat"];
                cell.titleLb.text = @"微信";
                return cell;
            }else if (indexPath.row == 3){
                UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell4"] ;
                if (!cell) {
                    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell4"];
                }
                cell.textLabel.text = @"支付宝账号";
                cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
                self.zhifubaoTextField = [[UITextField alloc] init];
                [cell addSubview:self.zhifubaoTextField];
                [self.zhifubaoTextField mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.mas_equalTo(-8);
                    make.top.mas_equalTo(4);
                    make.bottom.mas_equalTo(-4);
                    make.width.mas_equalTo(Width / 2.0 + 40);
                }];
                self.zhifubaoTextField.font = [UIFont systemFontOfSize: 16];
                self.zhifubaoTextField.textAlignment = NSTextAlignmentRight;
                self.zhifubaoTextField.placeholder = @"请输入支付宝账号";
                return cell;
                return cell;
            }else if (indexPath.row == 4) {
                UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell5"] ;
                if (!cell) {
                    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell5"];
                }
                cell.textLabel.text = @"持有人姓名";
                cell.textLabel.textColor = [UIColor colorWithRed:136/255.0 green:136/255.0 blue:136/255.0 alpha:1];
                self.personNameTextField = [[UITextField alloc] init];
                [cell addSubview:self.personNameTextField];
                [self.personNameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.right.mas_equalTo(-8);
                    make.top.mas_equalTo(4);
                    make.bottom.mas_equalTo(-4);
                    make.width.mas_equalTo(Width / 2.0 + 40);
                }];
                self.personNameTextField.font = [UIFont systemFontOfSize: 16];
                self.personNameTextField.textAlignment = NSTextAlignmentRight;
                self.personNameTextField.placeholder = @"请输入持有人姓名";
                return cell;
            }else {
                UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"lastCell"];
                if (!cell) {
                    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"lastCell"];
                }
                UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
                [cell addSubview:btn];
                btn.backgroundColor = [UIColor colorWithRed:255/255.0 green:88/255.0 blue:88/255.0 alpha:1];
                [btn setTitle:@"我要提现" forState:UIControlStateNormal];
                [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.mas_equalTo(20);
                    make.right.mas_equalTo(-20);
                    make.top.mas_equalTo(20);
                    make.height.mas_equalTo(40);
                }];
                [btn addTarget:self action:@selector(clickMakeCashBtn) forControlEvents:UIControlEventTouchUpInside];
                btn.layer.cornerRadius = 6;
                btn.layer.masksToBounds = YES;
                return cell;
            }
        }
    
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    if (section == 0) {
        return 0   ;
    }else {
        return 10;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.isPayByWeiChat) {
        switch (indexPath.section) {
            case 0:
                return 118 / 400.0 *Width;
                break;
            case 1:
                return 44;
                break;
            default:
                if (indexPath.row == 0) {
                    return 44;
                }else if (indexPath.row == 1 || indexPath.row == 2) {
                    return 50;
                }else if (indexPath.row == 3) {
                    return 44;
                }else {
                    return Height - 118 / 400.0 *Width - 44 * 3 - 50 * 2 - 20;
                }
                break;
        }
    }else {
        switch (indexPath.section) {
            case 0:
                return 118 / 400.0 *Width;
                break;
            case 1:
                return 44;
                break;
            default:
                if (indexPath.row == 0) {
                    return 44;
                }else if (indexPath.row == 1 || indexPath.row == 2) {
                    return 50;
                }else if (indexPath.row == 3 || indexPath.row == 4) {
                    return 44;
                }else {
                    return Height - 118 / 400.0 *Width - 44 * 3 - 50 * 2 - 20;
                }
                break;
        }
    }
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 1) {
        MakeCashHistoryTableViewController *vc = [MakeCashHistoryTableViewController CreatMakeCashHistoryTableViewController];
        [self creatNav:vc];
        
    }
    if (indexPath.section == 2) {
        if (indexPath.row == 1) {
            self.cashTextField.placeholder = @"";
            self.weichatTextField.placeholder = @"";
            self.zhifubaoTextField.placeholder = @"";
            self.personNameTextField.placeholder = @"";
            self.zhifubaoIsSelected = YES;
            self.weichatIsSelected = NO;
            PayDetailTableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];
            cell1.checkIV.hidden = NO;
            self.isPayByWeiChat = NO;
            NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:2 inSection:2];
            PayDetailTableViewCell *cell2 = [tableView cellForRowAtIndexPath:myIndexPath];
            cell2.checkIV.hidden = YES;
            [self.tableView reloadData];
        }
        if (indexPath.row == 2) {
            
            self.cashTextField.placeholder = @"";
            self.weichatTextField.placeholder = @"";
            self.zhifubaoTextField.placeholder = @"";
            self.personNameTextField.placeholder = @"";
            self.zhifubaoIsSelected = NO;
            self.weichatIsSelected = YES;
            PayDetailTableViewCell *cell1 = [tableView cellForRowAtIndexPath:indexPath];
            cell1.checkIV.hidden = NO;
            self.isPayByWeiChat = YES;
            NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:1 inSection:2];
            PayDetailTableViewCell *cell2 = [tableView cellForRowAtIndexPath:myIndexPath];
            cell2.checkIV.hidden = YES;
            [self.tableView reloadData];
        }
    }
}



/** 点击我要提现*/
- (void)clickMakeCashBtn {
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入支付密码" message:@"" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        MakeCashSuccessViewController *vc = [MakeCashSuccessViewController CreatMakeCashSuccessViewController];
        [self creatNav:vc];
        
    }];
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        // 可以在这里对textfield进行定制，例如改变背景色
        textField.borderStyle = UITextBorderStyleNone;
    }];
    [alert addAction:action1];
    [alert addAction:action2];
    [self presentViewController:alert animated:YES completion:^{
        
    }];
    
    
    
    
}


//创建模态导航控制器
-(void)creatNav:(UIViewController *)view{
    
    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:view];
    nav.navigationBar.barTintColor = [UIColor colorWithRed:254/255.0 green:154/255.0 blue:37/255.0 alpha:1];
    view.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_back"] style:UIBarButtonItemStylePlain target:self action:@selector(dismiss)];
    [self presentViewController:nav animated:YES completion:nil];
}

- (void)dismiss {
    [self dismissViewControllerAnimated:YES completion:nil];
}




-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.cashTextField resignFirstResponder];
    [self.weichatTextField resignFirstResponder];
}



/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
